package com.ccx.coachsite.data;



import java.io.File;

import android.content.Context;

import com.ccx.coachsite.util.LogUtil;
import com.ccx.coachsite.util.TelephoneUtil;



/**
 * 
 * @ClassName: SystemConst 
 * @Description: 初始化一些变量
 *
 */
public class SystemConst {
	

    public final static int NO_DATA = -1;
    public final static String BASE_DIR_OLD =	"/sdcard/CoachSite/";
	public final static String BASE_DIR		=	"/sdcard/YYZL/";
	public final static String DOWNLOAD_DIR	=	"/sdcard/YYZL/caches/downloads/";
	//public final static String IMAGES_DIR	=	"/sdcard/CoachSite/caches/images/";
	
	/**
     * 防止图库扫描该目录图片
     */
    public final static String BASE_DIR_AVOID_MEDIA_SCAN = BASE_DIR + "/.nomedia";
    
	public static String PACKAGE_NAME="";
	public static String firmwareVersion = "";
	public static String versionName = "";
	public static String imei = "";
	public static String imsi = "";
	public static String abi = "";
	public static String resolution = "";
	public static int sdk = 7;
	public static String model = "";
	public static final String CHANNELID = "E55nRJesInW7TdOpgzqFV4JG55pGjT3E";
	
	/**下载参数**/
	public static final int CONNETION_TIMES = 3;// 断线重连的次数 3次
	public static final int CONNETION_INTERVAL = 1000;// 断线重连的时间间隔 1S
	public static final int CONNECTION_TIMEOUT = 10000;
	
    /**
     * 创建系统常用目录
     */
	public static void createDefaultDir() {
		
		File dir = new File(BASE_DIR);
		if (!dir.isDirectory()) {
			File oldDir = new File(BASE_DIR_OLD);
			if (oldDir.isDirectory()) {
				oldDir.renameTo(dir);
			}else{
				dir.mkdirs();
			}
		}
		
		dir = new File(DOWNLOAD_DIR);
		if (!dir.isDirectory()) {
			dir.mkdirs();
		}
		/*
		dir = new File(IMAGES_DIR);
		if (!dir.isDirectory()) {
			dir.mkdirs();
		}
		*/
		dir = new File(BASE_DIR_AVOID_MEDIA_SCAN);
		if (!dir.isDirectory()) {
			dir.mkdirs();
		}
	}
	
	/**
	 * 程序一启动就初始化的全局变量,如imei imsi ...
	 * 
	 * @param ctx
	 */
	public static void init(Context ctx) {
		firmwareVersion = TelephoneUtil.getFirmWareVersion();
		resolution = TelephoneUtil.getScreenResolution(ctx);
		//resolutionXY = TelephoneUtil.getScreenResolutionXY(ctx);
		versionName = TelephoneUtil.getVersionName(ctx);
		imei = TelephoneUtil.getIMEI(ctx);
		imsi = TelephoneUtil.getIMSI(ctx);
		abi = TelephoneUtil.getCPUABI();
		sdk = TelephoneUtil.getApiLevel();
		model = TelephoneUtil.getMachineName();
//		PACKAGE_NAME = TelephoneUtil.getPackageName(ctx);
		PACKAGE_NAME="com.nd.android.softmgr";
		LogUtil.d("SystemConst", "PACKAGE_NAME="+PACKAGE_NAME);
	}
	
}
